package com.iye.puretennis.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.iye.puretennis.R;
import com.iye.puretennis.activity.test.FriendsActivity;
import com.iye.puretennis.activity.test.TabHostViewPagerActivity;
import com.iye.puretennis.domain.UserToken;
import com.iye.puretennis.helper.Config;
import com.iye.puretennis.helper.DBManager;

/**
 * Author: Chuanbao on 2014/11/7.
 */
public class LoginActivity extends Activity {
    DBManager dbManager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        dbManager = new DBManager(this);
    }


    public void myFriends(View view) {
        Intent intent = new Intent(this,FriendsActivity.class);
        startActivity(intent);
    }

    public void upwdPage(View view) {
        UserToken userToken = dbManager.retrieveCurrentUser();
//        Intent intent = new Intent(this,MainTabsActivity.class);
//        startActivity(intent);
        if(userToken == null){//第一次登录
            Intent intent = new Intent(this,LoginPageActivity.class);
            startActivity(intent);
        }else{ //已经登录直接跳转
            Intent intent = new Intent(this,MainTabsActivity.class);
            startActivity(intent);
        }
    }
}